﻿using SQLite;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Xarmarin.GoldFinger.Common.Utils;
using Xarmarin.GoldFinger.Data;
using Xarmarin.GoldFinger.Engine.Core;
using Xarmarin.GoldFinger.Models.AutoModels;

namespace Xarmarin.GoldFinger.ViewModels
{
    /// <summary>
    /// 当前主体对象
    /// </summary>
    public class SubjectViewModel
    {
        public SubjectViewModel()
        {
           
            using (var conn = new SQLiteConnection(CoreEngine.ConnectionString))
            {
                var result = conn.Table<Auto_Subject>();
                if (result.Any())
                {
                    Subjects = new ObservableCollection<Auto_Subject>();
                    foreach (var item in result)
                    {
                        Subjects.Add(item);
                    }
                }
            }
        }

        public long ID { get; set; }
        /// <summary>
        /// 编码
        /// </summary>
        public string BillCode { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        public string NickName { get; set; }
        /// <summary>
        /// 任命称号
        /// </summary>
        public string Designation { get; set; }
        /// <summary>
        /// 动态
        /// </summary>
        public ObservableCollection<Auto_Subject> Subjects { get; set; }

    }
}
